package com.itheima.edu.info.manager.day16;

import java.lang.reflect.Field;

public class ClassTest3 {
    public static void main(String[] args) throws NoSuchFieldException {
       // allfields();

       // allPublicFields();

       // getDeclaredField();

      //  getfield();
    }

    private static void getfield() throws NoSuchFieldException {
        Class c=Student.class;
        Field age = c.getField("age");
        System.out.println(age);
    }

    private static void getDeclaredField() throws NoSuchFieldException {
        Class c=Student.class;
        Field field = c.getDeclaredField("bame");
        System.out.println(field);
    }

    private static void allPublicFields() {
        Class c=Student.class;
        Field[] fields = c.getFields();
        for (Field field : fields) {
            System.out.println(field);
        }
    }

    private static void allfields() {
        Class c=Student.class;
        Field[] fields = c.getDeclaredFields();
        for (Field field : fields) {
            System.out.println(field);
        }
    }
}
